import React, { lazy, Suspense } from "react";
import { Routes, Route, Navigate } from "react-router-dom";
import MainLay from "./pages/MainLay";
import "./App.css";
import { LoadingOutlined } from "@ant-design/icons";
import auth from "./routers/auth";
const AuthMainLayOut = auth(MainLay);
const Login = lazy(() => import("./pages/login"));
const HomePages = lazy(() => import("./pages/Home"));
const CustomerPages = lazy(() => import("./pages/Customer-management"));
const OutSocurPages = lazy(() => import("./pages/Outsourcing-management"));
// 合同
const ContractPages = lazy(() =>
  import("./pages/Contract/Contract-management")
);
const ContractAppPages = lazy(() =>
  import("./pages/Contract/Contract-application")
);
const ContractModPages = lazy(() =>
  import("./pages/Contract/Contract-modification")
);
// 项目管理
const OperationalProjectPages = lazy(() =>
  import("./pages/Project-management/Operational-project-management")
);
const OperationalSubPages = lazy(() =>
  import("./pages/Project-management/Operation-subproject-management")
);
const OnlineProgressPages = lazy(() =>
  import("./pages/Project-management/Online-progress")
);
const FinancialPages = lazy(() => import("./pages/Financial-management"));
const DataAnalysisPages = lazy(() => import("./pages/Data-analysis-query"));

const LoadingPages = lazy(() => import("./components/Loading"));
const NoPages=lazy(()=>import('./components/No'))
function App() {
  return (
    <Suspense fallback={<div className="boxLoading"></div>}>
      <Routes>
        <Route path="/admin" element={<MainLay />}>
          <Route path="*" element={<div>暂未开发</div>} />
          <Route path="home" element={<HomePages />} />
          <Route path="customer" element={<CustomerPages />} />
          <Route path="outsocur" element={<OutSocurPages />} />
          {/* 合同 */}
          <Route path="contract" element={<ContractPages />} />
          <Route path="contractapp" element={<ContractAppPages />} />
          <Route path="contractmod" element={<ContractModPages />} />
          {/* 项目管理 */}
          <Route
            path="operationalproject"
            element={<OperationalProjectPages />}
          />
          <Route path="operationalsub" element={<OperationalSubPages />} />
          <Route path="financial" element={<FinancialPages />} />
          <Route path="dataanalysis" element={<DataAnalysisPages />} />
          <Route path="onlineprogress" element={<OnlineProgressPages />} />
        </Route>
        <Route path="login" element={<Login />} />
        <Route path="/404" element={<NoPages/>} />
        <Route path="/403" element={<div>403用户无权限</div>} />
        <Route path="*" element={<Navigate to="/404" />} />
        <Route path="/" element={<Navigate to="/admin/home/" />} />
      </Routes>
    </Suspense>
  );
}

export default App;
